// Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.

// 服务相关常量定义
package constants

const (
	TimeFormatLayout = "2006-01-02T15:04:05Z"
)

// Build
const (
	BuildStateInitialized = "INITIALIZED"
	BuildStateReady       = "READY"
	BuildImageInitialized = "IMAGE_CREATING"
	BuildStateFailed      = "FAILED"
	BuildDeleted          = "DELETED"
)

const (
	PODTYPE = "POD"
	VMTYPE  = "VM"
)

// Fleet
const (
	InstanceTypeVm   = "VM"
	InstanceTypePod  = "POD"
	DefaultNameSpace = "Default"
)

// EIP
const (
	PublicPoolStatusFreezed = "freezed"
	PublicPoolStatusActive  = "active"
)

// bandwidth
const (
	BandwidthShareTypeWhole        = "WHOLE"
	BandwidthShareTypePre          = "PRE"
	BandwidthChargingModeBandwidth = "bandwidth"
	BandwidthChargingModeTraffic   = "traffic"
)

// instance health state
const (
	InstanceHealthStateInitializing = "Activating"
	InstanceHealthStateNormal       = "Active"
	InstanceHealthStateError        = "Error"
)

// process state
const (
	AppProcessStateActivating  = "ACTIVATING"
	AppProcessStateActive      = "ACTIVE"
	AppProcessStateTerminating = "TERMINATING"
	AppProcessStateTerminated  = "TERMINATED"
	AppProcessStateError       = "ERROR"
)

// server session state
const (
	ServerSessionStateActivating = "ACTIVATING"
	ServerSessionStateActive     = "ACTIVE"
	ServerSessionStateTerminated = "TERMINATED"
	ServerSessionStateError      = "ERROR"
	ServerSessionStateCreating   = "CREATING"
)

// homepage sort mode: asc: 升序 desc: 降序
const (
	HomepageSortByInstanceAsc       = "instance_count"
	HomepageSortByInstanceDesc      = "-instance_count"
	HomepageSortByProcessAsc        = "process_count"
	HomepageSortByProcessDesc       = "-process_count"
	HomepageSortByServerSessionAsc  = "server_session_count"
	HomepageSortByServerSessionDesc = "-server_session_count"
	HomepageSortByCreationTimeAsc   = "creation_time"
	HomepageSortByCreationTimeDesc  = "-creation_time"
)

// 排序
const (
	FleetOrderBy          = "order_by"
	FleetTopCount         = "top"
	FleetCreationTimeDesc = "-creation_time"
	FleetCreationTimeAsc  = "creation_time"
)

const (
	CreatePodGroupUrlPattern       = "/v1/%s/instance-pod-groups"
	DeletePodGroupUrlPattern       = "/v1/%s/instance-pod-groups/%s"
	ListPodGroupUrlPattern         = "/v1/%s/instance-pod-groups"
	ShowPodGroupUrlPattern         = "/v1/%s/instance-pod-groups/%s"
	UpdateScalingGroupUrlPattern   = "/v1/%s/instance-scaling-groups/%s"
	CreateScalingGroupUrlPattern   = "/v1/%s/instance-scaling-groups"
	DeleteScalingGroupUrlPattern   = "/v1/%s/instance-scaling-groups/%s"
	ListScalingGroupUrlPattern     = "/v1/%s/instance-scaling-groups"
	ShowScalingGroupUrlPattern     = "/v1/%s/instance-scaling-groups/%s"
	CreateScalingPolicyUrl         = "/v1/%s/scaling-policies"
	ScalingPolicyUrlPattern        = "/v1/%s/scaling-policies/%s"
	BindScalingPolicyPattern       = "/v1/%s/scaling-policies/%s/bind"
	ScalingGroupLtsAccessConfig    = "/v1/%s/lts-access-config"
	ScalingGroupListAccessConfig   = "/v1/%s/list-lts-access-config"
	ScalingGroupLtsLogGroup        = "/v1/%s/lts-log-group"
	ScalingGroupListLogGroup       = "/v1/%s/list-lts-log-group"
	ScalingGroupLtsLogTransfer     = "/v1/%s/lts-transfer"
	ScalingGroupListLogTransfer    = "/v1/%s/list-lts-transfer"
	ServerSessionsUrl              = "/v1/server-sessions"
	ServerSessionCountsUrl         = "/v1/server-session-counts"
	ServerSessionUrlPattern        = "/v1/server-sessions/%s"
	ClientSessionsUrl              = "/v1/client-sessions"
	BatchCreateClientSessionUrl    = "/v1/client-sessions/batch-create"
	ClientSessionUrlPattern        = "/v1/client-sessions/%s"
	ProcessCountsUrl               = "/v1/app-process-counts"
	CreateResDomainUrl             = "/v3.0/OS-OPDomain/resdomain"
	CreateTokenUrl                 = "/v3/auth/tokens"
	CreateResUserUrl               = "/v3.0/OS-OPDomain/owner_user"
	ProcessesUrl                   = "/v1/app-processes"
	ServerProcessUrlPattern        = "/v1/app-processes/%s"
	APPGWMonitorFleetsUrl          = "/v1/monitor-fleets"
	APPGWMonitorInstancesUrl       = "/v1/monitor-instances"
	APPGWMonitorAppProcessesUrl    = "/v1/monitor-app-processes"
	APPGWMonitorServerSessionsUrl  = "/v1/monitor-server-sessions"
	AASSMonitorInstancesUrlPattern = "/v1/%s/monitor-instances"

	AASSCreateOrListEventUrlPattern = "/v1/%s/event"
	AASSShowEventUrlPattern         = "/v1/%s/event/%s"
	AASSTopicEventUrlPattern        = "/v1/%s/topic"
	AASSTopicSubcriptionUrlPattern  = "/v1/%s/topic/subscriptions/%s"
	AASSAddAgencyInfo               = "/v1/agency"
)

const (
	NormalConsoleEndpoint  = "https://console.huaweicloud.com"
	UlanqabConsoleEndpoint = "https://console.ulanqab.huawei.com"
	ObsListPattern         = "/obs/manage/%s/object/list"
	LogStreamPattern       = "groupId=%s&groupName=%s&topicId=%s&topicName=%s"
	SwrDaemon              = "mirror.swr.myhuaweicloud.com"
	SwrImageUrl            = "swr.%s.myhuaweicloud.com/%s/%s:%s"
)

//pod
const (
	PodCPULowerLimit                = 1
	PodCPUUpperLimit                = 64
	PodMemoryLowerLimit             = 2
	PodMemoryUpperLimit             = 512
	PodSpecificationRatioLowerLimit = 2
	PodSpecificationRatioUpperLimit = 8
	PodMemoryUnit                   = "Gi"
	PodEnvFleetId                   = "FLEET_ID"
	PodEnvAppGatewayEndpoint        = "APPGATEWAY_ENDPOINT"
	PodEnvInstanceType              = "INSTANCE_TYPE"
)
